package sh.grapendaal.tsuushin.module.uno.engine.domain.achievement.impl;

import sh.grapendaal.tsuushin.module.uno.engine.domain.Card;
import sh.grapendaal.tsuushin.module.uno.engine.domain.Card.Suit;
import sh.grapendaal.tsuushin.module.uno.engine.domain.achievement.Achievement;
import sh.grapendaal.tsuushin.module.uno.engine.dto.GameAction;
import sh.grapendaal.tsuushin.module.uno.engine.dto.GameState;

public class IMightNeedThisLaterAchievement extends Achievement {

	@Override
	public String getName() {
		return "I Might Need This Later";
	}

	@Override
	public String getDescription() {
		return "Drawing while you have a wildcard.";
	}

	@Override
	public boolean isEarned(GameState gameState) {
		boolean hasWildcard = false;
		for (Card card : gameState.getCurrentPlayer().getCards()) {
			if (card.getSuit() == Suit.WILDCARD) {
				hasWildcard = true;
				break;
			}
		}

		return gameState.getLastAction() == GameAction.CARD_DRAWN && hasWildcard;
	}

}
